﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Draw_Tab.ascx.cs" Inherits="APP_Controls_Draw_Tab" %>
<style type="text/css">
button,input,select,textarea{font-size:100%;outline:none}
table{border-collapse:collapse;border-spacing:0;}
.hide{display:none;}
.l{float:left;}
.r{float:right;}
.clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden;}
.clearfix{zoom:1;}
.sn_buy_lottery_box{position:relative;}
.sn_buy_box{position:relative;border:1px solid #D1D8E0;margin-top:-1px;}
.sn_buy_lottery_box .buy_tag{position:relative;z-index:10;}
.sn_buy_lottery_box .buy_tag li{float:left;width:74px;height:29px;line-height:29px;margin-right:5px;text-align:center;font-size:14px;cursor:pointer;border:1px solid #D1D8E0;background:#F1F1F1;}
.sn_buy_lottery_box .buy_tag li.cur{background:#fff;border-bottom:1px solid #fff;}
.sn_buy_lottery_box s.line{position:absolute;top:30px;left:0;width:1px;overflow:hidden;background:#c9c9c9;height:10px;z-index:11;}

</style> 
<link href="../css/newLottery.css" type="text/css" rel="stylesheet" />

<script type="text/javascript" src="../js/inputmail.js"></script>
<script type="text/javascript" >
    function addLottery(type, qs) { 
        var redBallArray = [];
        var blueBall;
        var blueBallArray = [];
        if (type == 1) { 
            for (var j = 0; j < 6; j++) {
                if ($("#spanNum_" + (j + 1)).val() == "" || parseInt($("#spanNum_" + (j + 1)).val()) <= 0 || parseInt($("#spanNum_" + (j + 1)).val()) > 33) {
                    alert("红球请在1-33之间选号!");
                    return;
                } else {
                    if (parseInt($("#spanNum_" + (j + 1)).val()) < 10) {
                        redBallArray.push("0" + $("#spanNum_" + (j + 1)).val());
                    }
                    else {
                        redBallArray.push($("#spanNum_" + (j + 1)).val());
                    }
                }
            }
            redBallArray.sort(function (a, b) { return a > b ? 1 : -1 });
            if ($("#spanNum_7").val() == "" || parseInt($("#spanNum_7").val()) <= 0 || parseInt($("#spanNum_7").val()) > 16) {
                alert("蓝球请在1-16之间选号!");
                return;
            } else {
                if (parseInt($("#spanNum_7").val()) < 10) {
                    blueBall = ("0" + $("#spanNum_7").val());
                }
                else {
                    blueBall = ($("#spanNum_7").val());
                }
            }
            $("#Hidden1").val(redBallArray + "+" + blueBall); 
        } else if (type == 2) { 
            for (var j = 0; j < 5; j++) {
                if ($("#spanNum2_" + (j + 1)).val() == "" || parseInt($("#spanNum2_" + (j + 1)).val()) <= 0 || parseInt($("#spanNum2_" + (j + 1)).val()) > 35) {
                    alert("红球请在1-35之间选号!");
                    return;
                } else {
                    if (parseInt($("#spanNum2_" + (j + 1)).val()) < 10) {
                        redBallArray.push("0" + $("#spanNum2_" + (j + 1)).val());
                    }
                    else {
                        redBallArray.push($("#spanNum2_" + (j + 1)).val());
                    }
                }
            }
            redBallArray.sort(function (a, b) { return a > b ? 1 : -1 });
            for (var j = 0; j < 2; j++) {
                if ($("#spanNum2_" + (j + 6)).val() == "" || parseInt($("#spanNum2_" + (j + 6)).val()) <= 0 || parseInt($("#spanNum2_" + (j + 6)).val()) > 12) {
                    alert("红球请在1-12之间选号!");
                    return;
                } else {
                    if (parseInt($("#spanNum2_" + (j + 6)).val()) < 10) {
                        blueBallArray.push("0" + $("#spanNum2_" + (j + 6)).val());
                    }
                    else {
                        blueBallArray.push($("#spanNum2_" + (j + 6)).val());
                    }
                }
            }
            blueBallArray.sort(function (a, b) { return a > b ? 1 : -1 });
            $("#Hidden2").val(redBallArray + "+" + blueBallArray); 
        } else if (type == 5) {  
            for (var j = 0; j < 3; j++) {
                if ($("#spanNum3_" + (j + 1)).val() == "" || parseInt($("#spanNum3_" + (j + 1)).val()) < 0 || parseInt($("#spanNum3_" + (j + 1)).val()) > 9) {
                    alert("请在0-9之间选号!");
                    return;
                } else {
                    redBallArray.push($("#spanNum3_" + (j + 1)).val());
                }
            }
            redBallArray.sort(function (a, b) { return a > b ? 1 : -1 });
            $("#Hidden3").val(redBallArray); 
        }
      jQuery('form').attr("action", "/Ajax/CMember.ashx?t=addLottery&type=" + type + "&qs=" + qs).submit();
    }
</script>
<div class="wrap">

<!-- 新增开发模块开始 -->
<div class="sn_buy_lottery_box">
  <ul class="buy_tag fix" id="buy_tag">
    <li class="cur">双色球</li>
    <li>大乐透</li>
    <li>福彩3D</li>
  </ul>
  <div class="sn_buy_box_tabbox fix" id="sn_buy_box">
  <div class="sn_buy_box ssq_buy_box">
    <div class="buy_type_title_index fix">
      <h3>双色球</h3>
      <div class="info">
          <p class="f14">第<span class="bold"><%=LotteryQs!=null?LotteryQs[0].Lotteryqs:"0000000" %></span>期</p>
          <p class="gray">离截止时间还有：<span id="ssq_time">
          <script language="JavaScript" type="text/javascript">     
                                var range = <%=secondsDiff%>
                                function myShow(){ 
	                                            var secday = 86400, sechour = 3600, days = 0, hours = 0, min = 0, sec = 0;
                                                    if (range > 0) {
                                                        days = parseInt(range / secday);
                                                        hours = parseInt((range % secday) / sechour);
                                                        min = parseInt(((range % secday) % sechour) / 60);
                                                        sec = ((range % secday) % sechour) % 60;
                                                        range--;
			                                $("#ssq_time").text(nol(days)+"天"+ nol(hours)+"小时"+nol(min)+"分"+nol(sec)+"秒"); 
                                                    }
		                                    else
		                                    {
			                                clearInterval(myInterval); 
		                                    }
                                }  
                                var myInterval = setInterval(myShow, 1000); 
                                function nol(h)
                                {
	                                return h > 9 ? h : '0' + h;
                                } 
                            </script> 
          </span></p>
      </div>
    </div>
    <div class="buy_type_choose_red gray">
      [红球]从1-33中选6个不重复的整数
      <span class="arrow"></span>
    </div>
    <div class="buy_type_choose_blue gray" style="padding-right: 323px;">
      [蓝球]从1-16中选一个整数
      <span class="arrow"></span>
    </div>
    <input type="hidden" id="Hidden1" name="Hidden1"/>
    <input type="hidden" id="Hidden2" name="Hidden2"/>
    <input type="hidden" id="Hidden3" name="Hidden3"/>
    <div id="ssq_choose" class="buy_type_index_ball cl fix">
      <input type="text" class="redball" value="0"  id="spanNum_1" />
      <input type="text" class="redball" value="0"  id="spanNum_2" />
      <input type="text" class="redball" value="0"  id="spanNum_3" />
      <input type="text" class="redball" value="0"  id="spanNum_4" />
      <input type="text" class="redball" value="0"  id="spanNum_5" />
      <input type="text" class="redball" value="0"  id="spanNum_6" />
      <input type="text" class="blueball" value="0"  id="spanNum_7" />
    </div>
    <div class="cl"></div>
    <div class="buy_type_index_cur_money gray">
      <p>每注<em class="strong">2元</em>，最高奖 <em class="strong">1000万</em></p>
      <p>当前奖池奖金<em class="strong"><%=selectLotteryJackpot(1,LotteryQs!=null?LotteryQs[0].Lotteryqs:"0000000") %>元</em></p>
    </div>
    <div class="buy_type_index_touzhu">
      <a href="javascript:void(0);"  onclick="addLottery(1,<%=LotteryQs!=null?LotteryQs[0].Lotteryqs:"0000000" %>)" class="touzhu_now">立即投注</a>
      <p class="touzhu_btn fix"><a href="###" id="ssq_random"><span>机选一注</span></a>
      <a id="ssq_clean" class="last" href="###"><span>清空</span></a></p>
      
    </div>  
  </div>
  <div class="sn_buy_box dlt_buy_box hide">
    <div class="buy_type_title_index fix">
      <h3>大乐透</h3>
      <p class="three_time">一次彩票兑三次</p>
      <div class="info">
          <p class="f14">第<span class="bold"><%=dltqs != null ? dltqs.Lotteryqs : "0000000"%></span>期</p>
          <p class="gray">离截止时间还有：<span id="dlt_time">
            <script language="JavaScript" type="text/javascript">     
                                var range = <%=dltseconds%>
                                function myShow(){ 
	                                            var secday = 86400, sechour = 3600, days = 0, hours = 0, min = 0, sec = 0;
                                                    if (range > 0) {
                                                        days = parseInt(range / secday);
                                                        hours = parseInt((range % secday) / sechour);
                                                        min = parseInt(((range % secday) % sechour) / 60);
                                                        sec = ((range % secday) % sechour) % 60;
                                                        range--;
			                                $("#dlt_time").text(nol(days)+"天"+ nol(hours)+"小时"+nol(min)+"分"+nol(sec)+"秒"); 
                                                    }
		                                    else
		                                    {
			                                clearInterval(myInterval); 
		                                    }
                                }  
                                var myInterval = setInterval(myShow, 1000); 
                                function nol(h)
                                {
	                                return h > 9 ? h : '0' + h;
                                } 
                            </script> 
          </span></p>
      </div>
    </div>
    <div class="buy_type_choose_red gray">
      [红球]从1-33中选6个不重复的整数
      <span class="arrow"></span>
    </div>
    <div class="buy_type_choose_blue gray" style="padding-right:365px;">
      [蓝球]从1-16中选一个整数
      <span class="arrow"></span>
    </div>
    <div id="dlt_choose" class="buy_type_index_ball cl fix">
      <input type="text" class="redball" value="00"   id="spanNum2_1" />
      <input type="text" class="redball" value="00"   id="spanNum2_2" />
      <input type="text" class="redball" value="00"   id="spanNum2_3" />
      <input type="text" class="redball" value="00"   id="spanNum2_4" />
      <input type="text" class="redball" value="00"   id="spanNum2_5" />
      <input type="text" class="blueball" value="00"  id="spanNum2_6" />
      <input type="text" class="blueball" value="00"   id="spanNum2_7" />
    </div>
    <div class="cl"></div>
    <div class="buy_type_index_cur_money gray">
      <p>每注<em class="strong">2元</em>，最高奖 <em class="strong">1000万</em></p>
      <p>当前奖池奖金<em class="strong"><%=selectLotteryJackpot(2,LotteryQs!=null?LotteryQs[1].Lotteryqs:"0000000") %>元</em></p>
    </div>
    <div class="buy_type_index_touzhu">
      <a href="javascript:void(0);"  onclick="addLottery(2,<%=LotteryQs!=null?LotteryQs[1].Lotteryqs:"0000000" %>)" class="touzhu_now">立即投注</a>
      <p class="touzhu_btn fix"><a href="###" id="dlt_random"><span>机选一注</span></a>
      <a id="dlt_clean" class="last" href="###"><span>清空</span></a></p> 
    </div>
    <div class="buy_type_index_help">
      <p class="zoushi"><s></s>走势图</p>
      <p class="wanfa"><s></s>玩法说明</p>
    </div>

  </div>
  <div class="sn_buy_box ssxw_buy_box hide">
    <div class="buy_type_title_index fix">
      <h3>福彩3d</h3>
      <div class="info">
          <p class="f14">第<span class="bold"><%=LotteryQs!=null?LotteryQs[4].Lotteryqs:"0000000" %></span>期</p>
          <p class="gray">离截止时间还有：<span id="ssxw_time">
          <script language="JavaScript" type="text/javascript">     
                                var range = <%=dseconds%>
                                function myShow(){ 
	                                            var secday = 86400, sechour = 3600, days = 0, hours = 0, min = 0, sec = 0;
                                                    if (range > 0) {
                                                        days = parseInt(range / secday);
                                                        hours = parseInt((range % secday) / sechour);
                                                        min = parseInt(((range % secday) % sechour) / 60);
                                                        sec = ((range % secday) % sechour) % 60;
                                                        range--;
			                                $("#ssxw_time").text(nol(days)+"天"+ nol(hours)+"小时"+nol(min)+"分"+nol(sec)+"秒"); 
                                                    }
		                                    else
		                                    {
			                                clearInterval(myInterval); 
		                                    }
                                }  
                                var myInterval = setInterval(myShow, 1000); 
                                function nol(h)
                                {
	                                return h > 9 ? h : '0' + h;
                                } 
                            </script>
          </span></p>
      </div>
    </div>
    <div class="buy_type_choose_red gray">
      从0-9中任选3个（可重复）数字组成一注彩票 
      <span class="arrow"></span>
    </div>
    <div id="ssxw_choose_ball">
      <div id="ssxw_choose3" class="buy_type_index_ball cl fix">
      <input type="text" class="redball" value="00"   id="spanNum3_1" />
      <input type="text" class="redball" value="00"   id="spanNum3_2" />
      <input type="text" class="redball" value="00"   id="spanNum3_3" /> 
      </div>
    </div>
    <div class="cl"></div>
    <div class="buy_type_index_cur_money gray">
      <p>千元奖金天天开 每天20:30开奖 </a>
      </p>
    </div>
   <div class="buy_type_index_touzhu">
      <a href="javascript:void(0);"  onclick="addLottery(5,<%=LotteryQs!=null?LotteryQs[4].Lotteryqs:"0000000" %>)"  class="touzhu_now">立即投注</a>
      <p class="touzhu_btn fix"><a href="###" id="ssxw_random"><span>机选一注</span></a>  
      <a id="ssxw_clean" class="buttonA last" href="###"><span>清空</span></a></p> 
    </div>
  </div>
  </div>
<s class="line"></s>
</div>
<!-- 新增开发模块结束 -->

<script type="text/javascript">
    /**
    * Code Width jQuery
    * 
    */

    /**
    * [sn_Lottery_choose description]
    * @param  {[type]} elem   [外层box]
    * @param  {[type]} numBox [滚动数字box]
    * @param  {[type]} count  [最大数字限制]
    * @return {[type]}        [function]
    */
    var sn_Lottery_choose = function (elem, numBox, count) {
        var Num = $(elem);
        var arrBall = [];
        var interval, index, i = 0;
        for (var i = 1; i < count; i++) {
            arrBall.push(i);
        }
        arrBall.sort(function () { return (Math.random() < 0.5 ? 1 : -1) });
        function setNum() {
            Num.find(numBox).each(function () {
                index = arrBall[Math.floor(Math.random() * (count - 1))];
                $(this).val(index);
            });
            i++;
            if (i > count + 15) {
                arrBall.sort(function () { return (Math.random() < 0.5 ? 1 : -1) });
                for (var j = 0; j < Num.find(numBox).length; j++) {
                    Num.find(numBox).eq(j).val(arrBall[j]);
                }
                return;
            }
            setTimeout(arguments.callee, 10);
        }

        setNum();
        Num.find(numBox).each(function () {

            $(this).blur(function () {
                if (parseInt($(this).val()) > (count - 1)) {
                    alert("请输入小于" + (count - 1) + "的数字！")
                    $(this).val("");
                }
            });
        });
    }

    function re_choose_number(redball, blueball) {
        sn_Lottery_choose(redball.id, redball.cls, redball.count);
        if (typeof blueball != "object") { return; }
        sn_Lottery_choose(blueball.id, blueball.cls, blueball.count); 
    }

    function clean_choose_number(id) {
        $(id).find("input").val("");
    }
    /**
    * [sn_Tabs description]
    * @param  {[type]} elem     [触发元素]
    * @param  {[type]} box      [选项卡容器]
    * @param  {[type]} boxclass [选项卡对应容器class]
    * @param  {[type]} type     [触发类型]
    * @param  {[type]} more     [是否有更多选项]
    * @return {[type]}          []
    */
    function sn_Tabs(elem, box, boxclass, type, more) {
        var para = arguments;
        var timeout;
        $(elem).find("li").bind(type, function () {
            var _this = $(this);
            var i = $(this).index();
            timeout = setTimeout(function () {
                _this.addClass("cur").siblings().removeClass("cur");
                $(box).find(boxclass).eq(i).show().siblings().hide();
                if (para.length > 5) {
                    //sn_Lottery_choose
                    var arr = [
          {
              id: "#ssq_choose",
              cls: ".redball",
              count: 34,
              blueball: {
                  id: "#ssq_choose",
                  cls: ".blueball",
                  count: 17

              }
          },
          {
              id: "#dlt_choose",
              cls: ".redball",
              count: 36,
              blueball: {
                  id: "#dlt_choose",
                  cls: ".blueball",
                  count: 13
              }
          }, {
              id: "#ssxw_choose_ball",
              cls: ".redball",
              count: 10
          }
        ];
                    re_choose_number(arr[i], arr[i].blueball);
                    if (i == $(elem).find("li").length - 1) {
                        sn_Tabs("#sswx_buy_tag", "#ssxw_choose_ball", ".buy_type_index_ball", "mouseover");
                    }
                }
                if (box == "#ssxw_choose_ball") {
                    //type = false;
                    sn_Lottery_choose("#ssxw_choose_ball", ".redball", 12);
                }
            }, 300);
        });

        $(elem).find("li").bind("mouseout", function () {
            clearTimeout(timeout)
        })

        if (box == "#sn_buy_box") {
            sn_Lottery_choose("#ssq_choose", ".redball", 34);
            sn_Lottery_choose("#ssq_choose", ".blueball", 17);
            sn_Lottery_random_clean();
        }

    }
    function sn_Lottery_random_clean() {
        $("#ssq_random").click(function () {
            sn_Lottery_choose("#ssq_choose", ".redball", 34);
            sn_Lottery_choose("#ssq_choose", ".blueball", 17);
        });
        $("#ssq_clean").click(function () {
            clean_choose_number("#ssq_choose");
        });
        $("#dlt_random").click(function () {
            sn_Lottery_choose("#dlt_choose", ".redball", 36);
            sn_Lottery_choose("#dlt_choose", ".blueball", 13);
        });
        $("#dlt_clean").click(function () {
            clean_choose_number("#dlt_choose");
        });
        $("#ssxw_random").click(function () {
            sn_Lottery_choose("#ssxw_choose_ball", ".redball", 10);
        });
        $("#ssxw_clean").click(function () {
            clean_choose_number("#ssxw_choose_ball");
        });
    }

    $(function () {

        sn_Tabs("#buy_tag", "#sn_buy_box", ".sn_buy_box", "mouseover", 0, 1);

    });
</script>


</div>